<?php
namespace Index\Widget;
use Think\Controller;
class RightWidget extends Controller{
	//右侧
	public function hot(){
		//热门博文
		$this->hot = M('blog')->field(array('id','title'))->where(array('del'=>0))->order('click DESC')->limit(5)->select();
		//最新发布
		$this->new = M('blog')->field(array('id','title'))->where(array('del'=>0))->order('time DESC')->limit(8)->select();
		//友情链接
		$this->link = M('link')->field(array('linkname','src'))->select();
		$this->display('Right:hot');
	}
	//当前位置
	public function location($data){
		$cid = $data;

			$category = M('category')->select();
			$result = get_all_parent($category,$cid);


		$this->lcid = $cid;
		$this->result = $result;
		$this->display('Right:location');
	}
}